home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Nov 1999
- // Author: Kevin Smith
- //
- // Description:
- // This script builds the pulldown and popup menus for the TraX
- // editor.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
- // Note:
- // None.
- //
-
- global int $currentCharacterState = 0;
-
- global proc buildClipEditorFileMenu (string $editor, string $parent)
- {
- setParent -menu $parent;
- if (`menu -query -numberOfItems $parent` != 0) return;
-
- menuItem -label "Import Clip..."
- -annotation "Open Clip From Disk."
- -command ("doImportClipArgList(\"2\",{\"0\"})")
- openClipItem;
-
- menuItem -label "Import Clip to Characters..."
- -annotation "Open Clip from Disk onto Selected Character Sets."
- -command ("performImportClipToChar 0")
- -dragMenuCommand ("performImportClipToChar 2")
- openClipToCharItem;
- menuItem -optionBox true
- -annotation "Import Clip To Character Option Box"
- -label "Import Clip To Character Option Box"
- -command ("performImportClipToChar 1")
- openClipToCharOBItem;
-
- string $exportEdCmd = ("doExportClipArgList 1 {\\\""+$editor+"\\\"}");
- menuItem -label "Export Clip..."
- -annotation "Save Clip to Disk: Select clip"
- -command ("evalEcho(\""+$exportEdCmd+"\")")
- SaveClipItem;
-
- menuItem -label "Export Character Map..."
- -annotation "Write Character Map Mel Script to Disk: Select 2 character sets. Then modify and execute the mel script to create a character map."
- -dragMenuCommand ("performExportCharacterMap 2")
- -command ("performExportCharacterMap 0")
- SaveCharacterMapItem;
- menuItem -optionBox true
- -annotation "Export Character Map Option Box"
- -label "Export Character Map Option Box"
- -command ("performExportCharacterMap 1")
- SaveCharacterMapDialogItem;
-
- menuItem -divider true;
-
- menuItem -label "Visor..."
- -enable 1
- -annotation "Open Visor Window."
- -command ("VisorWindow")
- //-dragMenuCommand("foo")
- openLibClipItem;
- }
-
- global proc buildClipEditorCreateMenu (string $editor, string $parent)
- {
- setParent -menu $parent;
- if (`menu -query -numberOfItems $parent` != 0) return;
-
- menuItem -label "Clip"
- -annotation "Create Clip: Select character set"
- -command ("CreateClip")
- -dragMenuCommand("performCreateClip 2")
- createClipItem;
- menuItem -optionBox true
- -annotation "Create Clip Option Box"
- -label "Create Clip Option Box"
- -command ("performCreateClip 1")
- createClipDialogItem;
-
- menuItem -label "Pose"
- -annotation "Create Pose: Select character set"
- -command ("performCreatePose 0")
- -dragMenuCommand("performCreatePose 2")
- createPoseItem;
- menuItem -optionBox true
- -annotation "Create Pose Option Box"
- -label "Create Pose Option Box"
- -command ("performCreatePose 1")
- createPoseDialogItem;
-
- menuItem -label "Blend"
- -annotation "Blend Clips: select two clips"
- -command ("performBlendClip 0 " + $editor)
- -dragMenuCommand("performBlendClip 2 " + $editor)
- blendClipsItem;
- menuItem -optionBox true
- -annotation "Blend Clips Option Box"
- -label "Blend Option Box"
- -command ("performBlendClip 1 " + $editor)
- blendClipsDialogItem;
-
- menuItem -l "Character Set"
- -annotation "Create: Create a character set"
- -c "CreateCharacter"
- -dragMenuCommand "performCreateCharacter 2"
- createCharacterItem;
- menuItem -optionBox true
- -annotation "Create Character Set Option Box"
- -l "Create Character Set Option Box"
- -c "performCreateCharacter 1"
- createCharacterDialogItem;
-
- menuItem -l "Time Warp"
- -annotation "Create Time Warp: select a clip"
- -command ("performCreateClipTimeWarp 0 " + $editor)
- -dragMenuCommand ("performCreateClipTimeWarp 2" + $editor)
- createClipTimeWarpItem;
- menuItem -optionBox true
- -annotation "Create Time Warp Option Box"
- -l "Create Time Warp Option Box"
- -c ("performCreateClipTimeWarp 1 " + $editor)
- createClipTimeWarpDialogItem;
- }
-
- global proc buildClipEditorEditMenu (string $editor, string $parent)
- {
- int $dimWhenNoSelect = 0;
- setParent -menu $parent;
-
- if (`menu -query -numberOfItems $parent` != 0) return;
-
- menuItem -label "Undo"
- -ecr false
- -annotation "Undo: Undo the last action"
- -command ("Undo") undoItem;
- if( $dimWhenNoSelect )
- dimWhen -f "UndoAvailable" ($parent+"|undoItem");
-
- menuItem -label "Redo"
- -ecr false
- -annotation "Redo: Redo the last undone action"
- -command ("Redo") redoItem;
- if( $dimWhenNoSelect )
- dimWhen -f "RedoAvailable" ($parent+"|redoItem");
-
- menuItem -divider true;
-
- string $removeCmd = "doCutClipArgList 1 { \""+ $editor+"\" }";
- menuItem -label "Cut"
- -annotation "Cut Selection: Select Clip|<other object(s)>"
- -command $removeCmd
- -dragMenuCommand $removeCmd;
-
- string $copyCmd = "doCopyClipArgList 1 { \""+ $editor+"\" }";
- menuItem -label "Copy"
- -annotation "Copy Clip: Select Clip"
- -command $copyCmd
- -dragMenuCommand $copyCmd;
-
- menuItem -label "Paste"
- -annotation "Paste Selection: Select Character Set"
- -command ("performPasteClip 0")
- -dragMenuCommand ("performPasteClip 2");
-
- menuItem -optionBox true
- -annotation "Paste Clip Option Box"
- -label "Paste Option Box"
- -command ("performPasteClip 1")
- pasteClipDialogItem;
-
- menuItem -divider true;
-
- string $splitString = ("performSplitClip 1 \\\""+$editor+"\\\"");
- string $splitCmd = ("evalEcho(\""+$splitString+"\")");
- menuItem -label "Split"
- -annotation "Split Clip: Select clip"
- -command ("performSplitClip 0 "+$editor)
- splitClipItem;
- menuItem -optionBox true
- -annotation "Split Clip Option Box"
- -label "Split Clip Option Box"
- -command $splitCmd
- splitClipDialogItem;
-
- menuItem -label "Merge"
- -annotation "Merge Clips: Select the clip(s) to merge."
- -command ("performBakeClip 0 " + $editor)
- -dragMenuCommand("performBakeClip 2 " + $editor)
- bakeClipsItem;
- menuItem -optionBox true
- -annotation "Merge Clips Option Box"
- -label "Merge Option Box"
- -command ("performBakeClip 1 " + $editor)
- bakeClipsDialogItem;
-
- menuItem -divider true;
-
- menuItem -label "Duplicate"
- -annotation "Duplicate Clip (copy animation curves): Select clip"
- -command ("performDuplicateClip 0 "+$editor)
- -dragMenuCommand ("performDuplicateClip 2 "+$editor)
- duplicateClipItem;
- menuItem -optionBox true
- -annotation "Duplicate Option Box"
- -label "Duplicate Option Box"
- -command ("performDuplicateClip 1 "+$editor)
- duplicateClipDialogItem;
-
- menuItem -label "Instance"
- -annotation "Instance (share animation curve with original): Select clip"
- -command ("performInstanceClip 0 " + $editor)
- -dragMenuCommand("performInstanceClip 2 " + $editor)
- instanceClipItem;
- menuItem -optionBox true
- -annotation "Instance Clip Option Box"
- -label "Instance Clip Option Box"
- -command ("performInstanceClip 1 " + $editor)
- instanceClipDialogItem;
- }
-
- global proc buildClipEditorLibraryMenu (string $editor, string $parent)
- {
- int $dimWhenNoSelect = 0;
- setParent -menu $parent;
-
- if (`menu -query -numberOfItems $parent` != 0) return;
-
- menuItem -l "Insert Clip" -sm true -aob 1 insertLibraryClipItem;
- menu -e -pmc "createClipLibraryMenu clip insertLibraryClipItem"
- insertLibraryClipItem;
- setParent -m ..;
-
- menuItem -l "Insert Pose" -sm true -aob 1 insertLibraryPoseItem;
- menu -e -pmc "createClipLibraryMenu pose insertLibraryPoseItem"
- insertLibraryPoseItem;
- setParent -m ..;
- }
-
- global proc frameTimelineRange (string $editor)
- {
- float $start, $end;
- $start = `playbackOptions -q -min`;
- $end = `playbackOptions -q -max`;
- clipEditor -e -fr $start $end $editor;
- }
-
- global proc selectSourceClip(string $editor)
- {
- string $sourceClips;
- string $selectedClips[] = `clipEditor -q -sc $editor`;
-
- int $ii;
- for ($ii = 0; $ii < size($selectedClips); $ii += 2) {
- int $clipIndex = $selectedClips[$ii+1];
- string $sch = $selectedClips[$ii];
- string $clipName = `clipSchedule -ci $clipIndex -q -n $sch`;
- string $sourceClip = `clip -q -scn $clipName`;
- $sourceClips += ($sourceClip+" ");
- }
-
- $cmd = ("select -r "+$sourceClips);
- evalEcho $cmd;
- }
-
- //
- // This method is called from the clipEditor command when the display
- // state of the editor changes.
- //
- global proc setCurrentCharacterList (string $editor, int $state)
- {
- global int $currentCharacterState;
- string $popupMenuName = ($editor + "PopupMenu");
- string $currentListItem = ($editor + "currentListItem");
-
- // If the menu has not been created, do nothing.
- if (!`popupMenu -exists $popupMenuName`)
- return;
-
- // Set the menuItem state.
- menuItem -e -cb $state $currentListItem;
- $currentCharacterState = $state;
- }
-
- //
- // This method is called from the menu item when the "List Current Characters"
- // item is selected.
- //
- global proc toggleCurrentCharacterList (string $curMenuItem, string $editor)
- {
- if (`menuItem -q -checkBox $curMenuItem`)
- clipEditor -e -listCurrentCharacters $editor;
- else
- clipEditor -e -listAllCharacters $editor;
- }
-
- global proc buildClipEditorViewMenu (string $editor, string $parent)
- {
- global int $currentCharacterState;
-
- setParent -menu $parent;
-
- // Make sure the current character toggle is up to date.
-
- if (`menu -query -numberOfItems $parent` != 0) {
- setCurrentCharacterList($editor, $currentCharacterState);
- return;
- }
-
- string $currentListItem = ($editor + "currentListItem");
- menuItem -label "List Current Character Sets Only"
- -checkBox 0
- -enable 1
- -command ("toggleCurrentCharacterList " + $currentListItem + " " + $editor)
- -annotation "List only the current character sets in the scene."
- $currentListItem;
- setCurrentCharacterList($editor, $currentCharacterState);
-
- menuItem -label "Frame All"
- -enable 1
- -annotation "Frame All Clips."
- -command ("FrameAll")
- frameAllItem;
-
- menuItem -label "Frame Timeline Range"
- -enable 1
- -annotation "Frame current timeline range."
- -command ("frameTimelineRange " + $editor)
- frameTimelineItem;
-
- menuItem -divider true;
-
- menuItem -label "Graph Anim Curves..."
- -enable 1
- -annotation "Graph Clip Animation Curves: Select clip"
- -command ("clipGraphEditor "+$editor)
- graphCurvesClipItem;
- }
-
- global proc buildClipEditorOptionsMenu (string $editor, string $parent)
- {
- string $traxRadioSmallName = ($editor + "TraxRadioSmallName");
- string $traxRadioLargeName = ($editor + "TraxRadioLargeName");
-
- setParent -menu $parent;
- if (`menu -query -numberOfItems $parent` != 0)
- return;
-
- radioMenuItemCollection;
- menuItem -label "Small Track Height"
- -rb 1
- -command "clipEditor -allTrackHeights 1"
- $traxRadioSmallName;
- menuItem -label "Large Track Height"
- -rb 1
- -command "clipEditor -allTrackHeights 2"
- $traxRadioLargeName;
-
- if (!`optionVar -exists traxEditorTrackHeight`)
- optionVar -iv traxEditorTrackHeight 1;
-
- if (`optionVar -q traxEditorTrackHeight` == 1) {
- menuItem -e -rb 1 $traxRadioSmallName;
- menuItem -e -rb 0 $traxRadioLargeName;
- }
- else {
- menuItem -e -rb 0 $traxRadioSmallName;
- menuItem -e -rb 1 $traxRadioLargeName;
- }
- }
-
- global proc buildClipEditorClipMenu (string $editor, string $parent)
- {
- setParent -menu $parent;
- if (`menu -query -numberOfItems $parent` != 0) return;
-
- menuItem -label "Attribute Editor..."
- -annotation "Attribute Editor: Edit clips"
- -command ("clipPropertiesWindow "+$editor)
- -dragMenuCommand ("clipPropertiesWindow "+$editor)
- clipPropItem;
-
- menuItem -divider true;
-
- string $enableCmd = "doEnableClipArgList 1 { \""+
- $editor+"\",\"2\"}";
- menuItem -label "Enable/Disable"
- -annotation "Enable or Disable Clip: Select clip"
- -command $enableCmd
- -dragMenuCommand $enableCmd
- enableClipItem;
-
- string $activateCmd = "doActivateClipArgList 1 { \""+
- $editor+"\",\"2\"}";
- menuItem -label "Activate/Deactivate Keys"
- -annotation "Activate or Dectivate Clip Keys (Move Keys to Timeline): Select clip"
- -command $activateCmd
- -dragMenuCommand $activateCmd
- activateClipItem;
-
- menuItem -divider true;
-
- menuItem -label "Add Track"
- -annotation "Add track to selected character set"
- -command ("clip -at")
- addTrackItem;
-
- menuItem -label "Remove Track"
- -annotation "Remove last unused track from selected character set"
- -command ("clip -rt")
- removeTrackItem;
-
- }
-
- global proc buildClipMainPopupMenuItems(string $editor, string $menuName,
- string $collectionName)
- {
- setParent -m $menuName;
-
- if (`menu -query -numberOfItems $menuName` != 0) return;
-
- string $menuItem = `menuItem -l "File"
- -subMenu true
- -allowOptionBoxes true
- FileCascade`;
-
- menuItem -edit -postMenuCommand
- ("buildClipEditorFileMenu " + $editor + " " + $menuItem) $menuItem;
- setParent -menu ..;
-
- string $menuItem = `menuItem -l "Edit"
- -subMenu true
- -allowOptionBoxes true
- EditCascade`;
-
- menuItem -edit -postMenuCommand
- ("buildClipEditorEditMenu " + $editor + " " + $menuItem) $menuItem;
- setParent -menu ..;
-
- string $menuItem = `menuItem -l "View"
- -subMenu true
- -allowOptionBoxes true
- ViewCascade`;
-
- menuItem -edit -postMenuCommand
- ("buildClipEditorViewMenu " + $editor + " " + $menuItem) $menuItem;
- setParent -menu ..;
-
- string $menuItem = `menuItem -l "Modify"
- -subMenu true
- -allowOptionBoxes true
- ModifyCascade`;
-
- menuItem -edit -postMenuCommand
- ("buildClipEditorClipMenu " + $editor + " " + $menuItem) $menuItem;
- setParent -menu ..;
-
- string $menuItem = `menuItem -l "Create"
- -subMenu true
- -allowOptionBoxes true
- CreateCascade`;
-
- menuItem -edit -postMenuCommand
- ("buildClipEditorCreateMenu " + $editor + " " + $menuItem) $menuItem;
- setParent -menu ..;
-
- string $menuItem = `menuItem -l "Options"
- -subMenu true
- -allowOptionBoxes true
- OptionsCascade`;
-
- menuItem -edit -postMenuCommand
- ("buildClipEditorOptionsMenu " + $editor + " " + $menuItem) $menuItem;
- setParent -menu ..;
-
- string $menuItem = `menuItem -l "Library"
- -subMenu true
- -allowOptionBoxes true
- LibraryCascade`;
-
- menuItem -edit -postMenuCommand
- ("buildClipEditorLibraryMenu " + $editor + " " + $menuItem) $menuItem;
- setParent -menu ..;
- }
-
-
- global proc buildClipEditorMenu(string $editor, string $parent,
- string $collectionName)
- {
- string $menu = `menu -l "File" -to true
- -familyImage "menuIconEdit.xpm"
- -allowOptionBoxes true`;
-
- menu -edit -postMenuCommand
- ("buildClipEditorFileMenu " + $editor + " " + $menu) $menu;
- setParent -menu ..;
-
- string $menu = `menu -l "Edit" -to true
- -familyImage "menuIconEdit.xpm"
- -allowOptionBoxes true`;
-
- menu -edit -postMenuCommand
- ("buildClipEditorEditMenu " + $editor + " " + $menu) $menu;
- setParent -menu ..;
-
- string $menu = `menu -l "View" -to true
- -allowOptionBoxes true
- -familyImage "menuIconEdit.xpm"`;
-
- menu -edit -postMenuCommand
- ("buildClipEditorViewMenu " + $editor + " " + $menu) $menu;
- setParent -menu ..;
-
- string $menu = `menu -l "Modify" -to true
- -allowOptionBoxes true
- -familyImage "menuIconEdit.xpm"`;
-
- menu -edit -postMenuCommand
- ("buildClipEditorClipMenu " + $editor + " " + $menu) $menu;
- setParent -menu ..;
-
- string $menu = `menu -l "Create" -to true
- -allowOptionBoxes true
- -familyImage "menuIconEdit.xpm"`;
-
- menu -edit -postMenuCommand
- ("buildClipEditorCreateMenu " + $editor + " " + $menu) $menu;
- setParent -menu ..;
-
- string $menu = `menu -l "Options" -to true
- -allowOptionBoxes true`;
-
- menu -edit -postMenuCommand
- ("buildClipEditorOptionsMenu " + $editor + " " + $menu) $menu;
- setParent -menu ..;
-
- string $menu = `menu -l "Library" -to true
- -familyImage "menuIconEdit.xpm"
- -allowOptionBoxes true`;
-
- menu -edit -postMenuCommand
- ("buildClipEditorLibraryMenu " + $editor + " " + $menu) $menu;
- setParent -menu ..;
- }
-
- global proc buildClipMenuItems(string $editor, string $menu)
- {
- setParent -m $menu;
-
- // Determine the status of the selected clips: enable, relative, active
- //
- int $ii;
- int $enableState; // 0 == all off, 1 == all on, 2 == mixed
- int $activeState; // 0 == all inactive, 1 == all active, 2 == mixed
- int $absState; // 0 == all relative, 1 == all absolute, 2 == mixed
- string $selClips[] = `clipEditor -q -sc $editor`;
- for ($ii = 0; $ii < size($selClips); $ii += 2) {
- int $cindex = $selClips[$ii+1];
- string $sch = $selClips[$ii];
- string $clipName = `clipSchedule -ci $cindex -q -n $sch`;
- string $ch[] = `listConnections -type character $sch`;
- if ($ii == 0) {
- $absState = `getAttr ($clipName+".offset")`;
- $enableState = `clipSchedule -ci $cindex -q -en $sch`;
- if (size($ch)) {
- string $activeClip = `clip -q -active $ch[0]`;
- string $sourceClip = `clip -q -scn $clipName`;
- $activeState = ($activeClip == $sourceClip);
- }
- } else {
- if ($enableState != `clipSchedule -ci $cindex -q -en $sch`) {
- $enableState = 2;
- }
- if ($absState != `getAttr ($clipName+".offset")`) {
- $absState = 2;
- }
- if (size($ch)) {
- string $activeClip = `clip -q -active $ch[0]`;
- string $sourceClip = `clip -q -scn $clipName`;
- int $currActive = ($activeClip == $sourceClip);
- if ($activeState != $currActive) {
- $activeState = 2;
- }
- }
- }
- }
-
- string $toggleEnableCmd = "doEnableClipArgList 1 { \""+
- $editor+"\",\"2\"}";
- menuItem -label "Enable Clip"
- -cb $enableState
- -en ($enableState != 2)
- -annotation "Enable/Disable Selected Clip(s)"
- -command $toggleEnableCmd
- -dragMenuCommand $toggleEnableCmd
- toggleEnableClipItem;
-
- string $toggleOffsetCmd = "toggleClipOffset 1 { \""+
- $editor+"\",\"2\"}";
- menuItem -label "Relative Clip"
- -cb ($absState == 0)
- -en ($absState != 2)
- -annotation "Make Clip Absolute or Relative"
- -command $toggleOffsetCmd
- -dragMenuCommand $toggleOffsetCmd
- toggleOffsetClipItem;
-
- string $activateCmd = "doActivateClipArgList 1 { \""+
- $editor+"\",\"2\"}";
- menuItem -label "Activate Keys"
- -cb $activeState
- -en ($activeState != 2)
- -annotation "Activate or Deactivate Clip Keys (Move Keys to Timeline): Select clip"
- -command $activateCmd
- -dragMenuCommand $activateCmd
- activateClipItem;
-
- menuItem -divider true;
-
- string $removeCmd = "doCutClipArgList 1 { \""+ $editor+"\" }";
- menuItem -label "Cut Clip"
- -annotation "Cut Clip"
- -command $removeCmd
- -dragMenuCommand $removeCmd;
-
- string $copyCmd = "doCopyClipArgList 1 { \""+ $editor+"\" }";
- menuItem -label "Copy Clip"
- -annotation "Copy Clip"
- -command $copyCmd
- -dragMenuCommand $copyCmd;
-
- string $splitString = ("doSplitClipArgList 1 {\"currTimeMethod\",\"0\",\""+$editor+"\"}");
- string $splitCmd = $splitString ; // ("evalEcho(\""+$splitString+"\")");
- menuItem -label "Split Clip"
- -annotation "Split Clip: Select clip"
- -command $splitCmd;
-
- menuItem -divider true;
-
- menuItem -label "Attribute Editor..."
- -annotation "Attribute Editor: Edit Clip"
- -command ("clipPropertiesWindow "+$editor)
- -dragMenuCommand ("clipPropertiesWindow "+$editor)
- clipPropItem;
-
- menuItem -divider true;
-
- menuItem -label "Create Time Warp"
- -annotation "Create Time Warp"
- -command ("performCreateClipTimeWarp 0 " + $editor)
- -dragMenuCommand("performBlendClip 2 " + $editor)
- clipTimeWarpItem;
-
- menuItem -label "Blend Clips"
- -annotation "Blend Clips: select two clips"
- -command ("performBlendClip 0 " + $editor)
- -dragMenuCommand("performBlendClip 2 " + $editor)
- -en (size($selClips) == 4)
- blendClipsItem;
-
- menuItem -divider true;
-
- menuItem -label "Select Source Clip"
- -annotation "Select the related source clip for this clip"
- -command ("selectSourceClip "+$editor) ;
- }
-
- //
- // query if clip is in selection list
- //
- proc int isClipSelected( string $clipEditor, string $clip[] )
- {
- string $selectedClips[] = `clipEditor -q -sc $clipEditor`;
- int $numClips = size($selectedClips);
- int $i;
- for ($i=0; $i < $numClips; $i+=2)
- {
- if ( $clip[0] == $selectedClips[$i] &&
- $clip[1] == $selectedClips[$i+1] )
- return 1;
- }
- return 0;
- }
-
- //
- // verify highlighted clip is in selection; if not select it.
- //
- proc selectHighlightedClip( string $clipEditor )
- {
- string $hlClip[] = `clipEditor -q -hc $clipEditor`;
-
- if ($hlClip[0] != "")
- {
- if (!isClipSelected( $clipEditor, $hlClip ))
- {
- clipEditor -edit -deselectAll $clipEditor;
- clipEditor -edit -selectClip $hlClip[0] $hlClip[1] $clipEditor;
- }
- }
- }
-
-
- global proc buildClipEditorMenuItems(string $editor, string $menu, string $collectionName)
- {
- if (`popupMenu -e -exists $menu`)
- {
- // check if mouse over a context-sensitive object
- //
- string $menuContext[] = `clipEditor -query -menuContext $editor`;
-
- // yes, it is. check what type of object it is
- //
- popupMenu -e -deleteAllItems $menu;
-
- if ($menuContext[0] == "clip")
- {
- selectHighlightedClip( $editor );
- buildClipMenuItems( $editor, $menu );
- }
- else {
- popupMenu -e -deleteAllItems $menu;
- buildClipMainPopupMenuItems($editor, $menu, $collectionName);
- }
-
- }
- }
-
-
- //
- // Attach commands to toolbar buttons
- //
- proc defineButtonCommands (string $editor)
- {
- int $dimWhenNoSelect = 0;
-
- iconTextButton -edit -command ("CreateClip")
- createClipButton;
- iconTextButton -edit -command ("performBlendClip 0 " + $editor)
- createBlendButton;
- iconTextButton -edit -command ("VisorWindow")
- openVisorButton;
-
- iconTextButton -edit -command ("FrameAll")
- frameAllButton;
-
- iconTextButton -edit -command ("frameTimelineRange " + $editor)
- frameRangeButton;
-
- iconTextButton -edit -command ("clipGraphEditor " + $editor)
- graphAnimCurvesButton;
- }
-
-
- global proc ClipEdMenu(string $editor)
- {
-
- // Find the name of the control that the menu will be attached to
- //
- string $parent = `clipEditor -query -control $editor`;
- string $popupMenuName = ($editor + "PopupMenu");
- string $collectionNameMenu = "Menu";
- string $collectionNamePopup = "Popup";
-
- // Create the popup menu
- //
- if (!`popupMenu -exists $popupMenuName`)
- {
- string $fullMenuName = `popupMenu -parent $parent $popupMenuName`;
- popupMenu -e
- -parent $parent
- -pmc ("buildClipEditorMenuItems " + $editor + " " + $fullMenuName + " " +
- $collectionNamePopup)
- $popupMenuName;
- }
-
- buildClipEditorMenu $editor "ClipEditorMenu" $collectionNameMenu;
- defineButtonCommands($editor);
- }
-
- //
- // This method is called from the clipEditor command when the track
- // height of the editor changes.
- //
- global proc setClipEdTrackHeight(int $height)
- {
- // If the height is not 1 or 2, just return.
- if (($height != 1) && ($height != 2))
- return;
-
- // Set the optionVar to the height.
- optionVar -intValue traxEditorTrackHeight $height;
-
- int $radioSmallValue = 1;
- int $radioLargeValue = 0;
-
- if (`optionVar -q traxEditorTrackHeight` == 2) {
- $radioSmallValue = 0;
- $radioLargeValue = 1;
- }
-
- // Look for all menu itmems which are track height radios and set their
- // button values.
- string $items[] = `lsUI -ed`;
- for ($pitem in $items) {
- string $regExpr = "clipEditorPanel.*ClipEditor";
- string $s = match($regExpr, $pitem);
- if (`strcmp $s $pitem` == 0) {
- string $popupMenuName = ($pitem + "PopupMenu");
- if (`popupMenu -exists $popupMenuName`) {
- string $radioSmallStr = ($pitem + "TraxRadioSmallName");
- string $radioLargeStr = ($pitem + "TraxRadioLargeName");
- menuItem -e -rb $radioSmallValue $radioSmallStr;
- menuItem -e -rb $radioLargeValue $radioLargeStr;
- }
- }
- }
- }
-
-
- //
- // Procedure Name:
- // createClipLibraryMenu
- //
- // Description:
- // Create the menu that lists source clips from the clipLibrary
- //
- // Input Arguments:
- // $parent - parent menu
- //
- // Return Value:
- // None
- //
- global proc createClipLibraryMenu( string $type, string $parent ) {
- setParent -m $parent;
- menu -e -dai $parent;
-
- source addVisorFolders;
- source hypergraphAnimClipMenu;
-
- // Get clips on current character
- //
- string $charClips[];
- string $unusedClips[];
- string $currChars[] = `currentCharacters`;
- if ($type == "pose") {
- $charClips = `getAllCharacterPoses`;
- $unusedClips = `getLibraryPoses`;
- } else {
- $charClips = `getAllCharacterClips`;
- $unusedClips = `getLibraryClips`;
- }
- int $total = size($charClips) + size($unusedClips);
-
- if( $total == 0 ) {
- menuItem -l ("No "+$type+"s on current character set") -enable false;
- } else {
- string $cmd;
- string $annotation;
- string $clipName;
- for( $clipName in $charClips ) {
- $annotation = ( "Insert " + $clipName );
- $cmd = ("clipInstanceMenuCommand "+$clipName);
- menuItem -l $clipName -c $cmd -annotation $annotation;
- }
- if (size($unusedClips)) {
- menuItem -divider true;
- for( $clipName in $unusedClips ) {
- $cmd = ( "clip -copy " + $clipName + "; doPasteClipArgList 2 { \"byAttrName\", \"currentTime\" }" );
- $annotation = ( "Insert " + $clipName );
- menuItem -l $clipName -c $cmd -annotation $annotation;
- }
- }
- }
- }
-